<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>成员授权</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link href="__PUBLIC__/css/layui.css" rel="stylesheet" type="text/css"/>
    <link href="__PUBLIC__/css/admin.css" rel="stylesheet" type="text/css"/>
    <link href="__PUBLIC__/css/public.css" rel="stylesheet" type="text/css"/>
    <style>
    .visit-ck{
        color: blue;
    }
    
    </style>
    
</head>
<body>
<div class="layui-conter">
    <div class="layui-col-md12">
        <div class="navigation">
            <span>权限管理></span><span>成员授权</span>
        </div>

        <div class="white-conter">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="title-blue"><a href="{:U('User/add')}" class="add fb J_showdialog">添加管理员</a></div>
                </div>
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body">
                            <table  class="layui-hide" id="test-table-operate" lay-filter="test-table-operate"></table>
                            <div class="layui-form layui-border-box layui-table-view" lay-filter="LAY-table-1">
                                <div class="layui-table-box" style="margin-bottom: 20px">
                                    <div class="layui-table-body layui-table-main">
                                        <table cellspacing="0" cellpadding="0" border="0" class="layui-table">
                                            <thead>
                                            <tr>
                                                <th data-field="p-workernum">
                                                    <div class="layui-table-cell laytable-cell-p-workernum">
                                                        <span>ID</span>
                                                        </span>
                                                    </div>
                                                </th>
                                                <th data-field="p-name">
                                                    <div class="layui-table-cell laytable-cell-p-name" align="center">
                                                        <span>登陆账号</span>
                                                    </div>
                                                </th>
                                                <th data-field="p-department">
                                                    <div class="layui-table-cell laytable-cell-p-department" align="center">
                                                        <span>角色</span>
                                                    </div>
                                                </th>
                                                <th data-field="p-standardday">
                                                    <div class="layui-table-cell laytable-cell-p-standardday" align="center">
                                                        <span>状态</span>
                                                    </div>
                                                </th>
                                                </th>
                                                <th data-field="operation">
                                                    <div class="layui-table-cell laytable-cell-1-operation" align="center">
                                                        <span>操作</span>
                                                    </div>
                                                </th>
                                            </tr>
                                            </thead>
                                            <tbody>
																						<foreach name="data" item="v">
                                            <tr data-index="0" class="" id="user{$v.id}">
                                                <td data-field="p-workernum" align="center">
                                                    <div class="layui-table-cell laytable-cell-p-workernum">{$v.id}</div>
                                                </td>
                                                <td data-field="p-name" align="center">
                                                    <div class="layui-table-cell laytable-cell-p-name">{$v.name}</div>
                                                </td>
                                                <td data-field="p-department" align="center">
                                                    <div class="layui-table-cell laytable-cell-p-department">
                                                        {$v.title}
                                                    </div>
                                                </td>
                                                <td data-field="p-standardday" align="center">
                                                    <div class="layui-table-cell laytable-cell-p-standardday">
																											<if condition="$v.quit_id eq 0">离职</if>
																											<if condition="$v.quit_id eq 1">在职</if>
																										</div>
                                                </td>
                                                <td data-field="operation" align="center" >
                                                    <div class="layui-table-cell laytable-cell-1-operation">
																										<a href="{:U('User/edit',array('id'=>$v['id']))}" class="visit-ck">编辑</a> 
																										| <a href="javascript:del({$v.id})" style="color: red;">删除</a>
                                                    </div>
                                                </td>
                                            </tr>
																						</foreach>
                                            </tbody>
                                        </table>
                                        
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        


    </div>
</div>
</body>
<script src="__PUBLIC__/js/layui.all.js"></script>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
    });
</script>
<script src="__PUBLIC__/js/jquery.js"></script>
<script>
//ajax删除幻灯片
function del(id) {
	if(confirm('你确认要删除管理员吗?')) {
		$.post("__CONTROLLER__/del",{id:id},function(data){
			if(data == -3) {
				alert('不能删除超级管理员 ');
			}else if(data == -2) {
				alert('管理员不能删除自己');
			}else if(data == -1) {
				alert('删除只能是ajax方式');
			}else if(data == 0) {
				alert('删除失败,请重新刷新重试');
				location.reload();  //重新加载页面
			}else if(data == 1) {
				$('#user'+id).remove();//直接移除
				window.location.href="__ACTION__";
			}
		},'json')
	}
}
</script>
</html>	